import json

import requests  # 配置北向用户信息及北向地址nbi_name = "campus02@north.com"
from urllib3.exceptions import InsecureRequestWarning

from DjangoDemo.scripts import SiteID
from DjangoDemo.scripts.Http_Management import Http_Management
from DjangoDemo.scripts.Token import Token


class c2_3:
    def __init__(self, site_name):


        self.site_name = SiteID.Sites.get_mac(site_name)

        # 定义接口的 URI
        POST_LiST_URI = "/rest/campusclientservice/v1/journey/kpi/trend"

        jBody = '''{
            "tenantId":"default-organization-id",
            "startTime":"1598544000000",
            "endTime":"1598599020000",
            "userType":"journey",
            "trendType":"2",
            "userMac":"30-00-00-00-00-30",
            "key":""
            }'''
        self.token = Token()
        self.r = Http_Management(self.token).post(POST_LiST_URI, jBody)



if __name__ == '__main__':
    now = c2_3("Shenzhen")
    print(now.r.json())
